/*
 * @Description: 经典继承
 * @Author: rendc
 * @Date: 2021-09-03 14:59:05
 * @LastEditors: rendc
 * @LastEditTime: 2021-09-03 15:32:56
 */
function Animal (name, age) {
  this.name = name;
  this.age = age;
  this.sayName = function () {
    console.log(this.name);
  }
}
Animal.prototype.sayAge = function () {
  console.log(this.age);
}

function Dog (name, age, color, type) {
  // this.name = name;
  // this.age = age;
  // 借用构造函数
  // 找到父类
  Animal.call(this, name, age);
  this.color = color;
  this.type = type;
}

var dog = new Dog('铃铛', 1, 'yellow', '金毛');
console.log(dog);
dog.sayName();
// dog.sayAge(); //报错 因为是父类原型中的方法

